
const app = getApp() // 获取app.js这个文件



import { getProductInfo } from "../../api/product";

Page({
  data: { // 定义变量
    indicatorDots: true,
    autoplay: true,
    interval: 3000,
    duration: 1000,
    text: "服务第一，为满足我校学生的便利及商品的质量，承诺：价格便宜，商品性价比高！！！",
    step: 1000, // 滚动速度
    distance: 100, // 初始滚动距离
    space: 300,
    imgUrls: [
      '../../images/公告1.png',
    ],
    goods: ''

  },
  detail(e) {
    let id = e.currentTarget.dataset.item.id
    wx.navigateTo({
      url: '/pages/details/details?id='+ id,
    })
  },
  onLoad: function (options) {

  },

  getProductInfo () {
    var that = this;
    getProductInfo().then(res => {
      that.setData({
        goods : res.data
      })
      
    })
  },

  onShow: function () {
    this.getProductInfo()
  },

})